﻿//========================================================================//
//      Copyright 2012, Smilodon Studio Inc.
//      All rights reserved.
//========================================================================//

/**
 *	pmusic
 *      @author: CYS
 */



var pmusic = function()
{
	this.x = 0;
	this.y = 0;
	this.c = new Color();
	this.c.setRGB(rnd(1), rnd(1), rnd(1));
	this.lastx = 0;
	this.lasty = 0;
	this.lastSize = g2D.lineWidth;
	this.id = -1;
	this.size = 10;
	this.life = 0;
	
}

pmusic.prototype.draw = function() 
{
	if(this.life <= 0) return;
	var x = 1 -this.life;
	x = Math.pow(x, 0.4);
	this.c.a =(1 - x)*0.5;
	this.size = 150*x;
	var col = this.c.getValue();
	g2D.shadowColor   = col;
	g2D.fillStyle = col;
	g2D.strokeStyle = col; 
	g2D.beginPath();
	g2D.arc(this.x, this.y, this.size, 0, 2*Math.PI, true );
	g2D.closePath();
	g2D.fill();
	
	g2D.stroke();
	
	this.life -= 0.01;
}


pmusic.prototype.begin = function(x, y, c, id)
{
	this.x = this.lastx = x; 
	this.y = this.lasty = y; 
	this.id = id;
	this.c = c;
	this.life = 1;
	this.size = 10;

}


pmusic.prototype.add = function(x, y)
{
	this.x = x;
	this.y = y;
}


pmusic.prototype.end = function()
{
	
}

